@turf/distance-weight
pNormDistance
calcualte the Minkowski p-norm distance between two features.
Parameters
feature1
Feature<Point> point featurefeature2
Feature<Point> point featurep
p-norm 1=<p<=infinity 1: Manhattan distance 2: Euclidean distance (optional, default 2
)
Returns number
distanceWeight
Parameters
Examples
var bbox = [-65, 40, -63, 42];
var dataset = turf.randomPoint(100, { bbox: bbox });
var result = turf.distanceWeight(dataset);
Returns Array<Array<number>> distance weight matrix.
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Installation
Install this single module individually:
$ npm install @turf/distance-weight
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf